#ifndef _INTERFACE_F3LAMPINTERFACE_
#define _INTERFACE_F3LAMPINTERFACE_

#include "PlatformTypes.h"


//=========================== Common ===============================
typedef enum OnOffFlag
{
    OnOff_Initial = 0x00,
    OnOff_Off     = 0x01,
    OnOff_On      = 0x02,
    OnOff_Invalid = 0x03,
}OnOffFlag;

typedef enum ADS_HiBeamReqType
{
    ADS_HiBeamNo_Request = 0x00,
    ADS_HiBeamOff = 0X01,
    ADS_HiBeamOn = 0X02,
} ADS_HiBeamReqType;

typedef enum ADS_HMAStatusType
{
    ADS_HMAStatus_Off = 0x00,
    ADS_HMAStatus_Standby = 0x01,
    ADS_HMAStatus_Active = 0x02,
    ADS_HMAStatus_Failure = 0x03,
} ADS_HMAStatusType;

typedef enum DiagFlag
{
    Diag_Initial = 0x00,
    Diag_NoFault = 0x01,
    Diag_Fault   = 0x02,
    Diag_Invalid = 0x03,
}DiagFlag;

typedef enum ProjectionAngle
{
    ProjectionAngle_Level0 = 0x00,      
    ProjectionAngle_Level1 = 0x01,      
    ProjectionAngle_Level2   = 0x02,    
    ProjectionAngle_Invaild3 = 0x03,    
    ProjectionAngle_Invaild4 = 0x04,    
    ProjectionAngle_Invaild5 = 0x05,    
    ProjectionAngle_Invaild6 = 0x06,    
    ProjectionAngle_Invaild7 = 0x07,    
} ProjectionAngle;

typedef enum UsageModeFlag
{
    UsageMode_Abandoned = 0x00,
    UsageMode_Inactive = 0x01,      
    UsageMode_Convenience = 0x02,   
    UsageMode_Driving = 0x03,
    UsageMode_OTA_Updating = 0x04,  
    UsageMode_Remote = 0x05,        
    UsageMode_RemoteDriving = 0x06,
    UsageMode_reserved_7 = 0x07,
    UsageMode_reserved_8 = 0x08,
    UsageMode_reserved_9 = 0x09,
    UsageMode_reserved_a = 0x0a,
    UsageMode_reserved_b = 0x0b,
    UsageMode_reserved_c = 0x0c,
    UsageMode_reserved_d = 0x0d,
    UsageMode_Invalid = 0x0e,
} UsageModeFlag;

typedef enum RibbonCtrlCmd
{
    RibbonCtrl_Initial = 0x00,
    RibbonCtrl_NoRequest = 0x01,
    RibbonCtrl_Off = 0x02,
    RibbonCtrl_On = 0x03,
    RibbonCtrl_Pause = 0x04,
    RibbonCtrl_Again = 0x05,
    RibbonCtrl_Invalid = 0x0f,
} RibbonCtrlCmd;

typedef enum RibbonEffectSel
{
    RibbonEffectSel_Initial = 0x00,
    RibbonEffect_Effect_1 = 0x01,
    RibbonEffect_Effect_2 = 0x02,
    RibbonEffect_Effect_3 = 0x03,
    RibbonEffect_Effect_4 = 0x04,
    RibbonEffect_Effect_5 = 0x05,
    RibbonEffect_Effect_6 = 0x06,
    RibbonEffect_Effect_7 = 0x07,
    RibbonEffect_Effect_8 = 0x08,
    RibbonEffect_Effect_9 = 0x09,
    RibbonEffect_Effect_a = 0x0a,
    RibbonEffect_Effect_b = 0x0b,
    RibbonEffect_Effect_c = 0x0c,
    RibbonEffect_Effect_d = 0x0d,
    RibbonEffect_Effect_e = 0x0e,
    RibbonEffect_Effect_f = 0x0f,
} RibbonEffectSel;

typedef enum RibbonEffectMod
{
    RibbonEffectMod_Initial = 0x00,
    RibbonEffectMod_Off = 0x01,
    RibbonEffectMod_Hold = 0x02,
    RibbonEffectMod_Repeat = 0x03,
} RibbonEffectMod;

typedef enum RibbonEffectShowSt
{
    RibbonEffectShow_OFF = 0x00,
    RibbonEffectShow_Running = 0x01,
    RibbonEffectShow_Pause = 0x02,
    RibbonEffectShow_Hold = 0x03,
    RibbonEffectShow_Reserved_4 = 0x04,
    RibbonEffectShow_Reserved_5 = 0x05,
    RibbonEffectShow_Reserved_6 = 0x06,
    RibbonEffectShow_Invalid = 0x07,
} RibbonEffectShowSt;

typedef enum TurnLampOccupyStsFlag
{
    TurnLampOccupySts_OFF = 0x00,
    TurnLampOccupySts_LeTurn = 0x01,
    TurnLampOccupySts_RiTurn = 0x02,
    TurnLampOccupySts_ALL = 0x0f,
} TurnLampOccupyStsFlag;

typedef enum FLPosnLampBriSetFlag
{
    PosnLampBri_Initial  = 0x00,
    PosnLampBri_Night    = 0x01,
    PosnLampBri_Daytime1 = 0x02,
    PosnLampBri_Daytime2 = 0x03,
    PosnLampBri_Invalid  = 0x07,
} FLPosnLampBriSetFlag;

typedef enum AFSEnaFlag
{
    AppAFSEna_Initial = 0x00,
    AppAFSEna_Disable = 0x01,
    AppAFSEna_Enable = 0x02,
    AppAFSEna_Invalid = 0x03,
} AFSEnaFlag;

#define PosnLampOutput_Initial_MA 0.0f
#define PosnLampOutput_Night_MA 12.0f
#define PosnLampOutput_DAY1_MA 28.0f
#define PosnLampOutput_DAY2_MA 50.0f
#define DaytimeLampOutput_MA 188.0f
#define DaytimeLampPwm_MaxCurrent 74.0f//MA
#define StarrySkyLamp_MaxCurrent 68.75f
#define StarrySkyLampOutput_Night_MA 26.0f
#define StarrySkyLampOutput_DAY1_MA 52.0f
#define StarrySkyLampOutput_DAY2_MA 100.0f
#define LeturnLamp_MaxCurrent 192.0f //MA
#define CornerLapmEnableVehicleSpeedThreshold 50.0f
#define CornerLapmEnableSteeringAngleThresholdUpller 18.0f
#define CornerLapmEnableSteeringAngleThresholdFloor  -18.0f

//=========================== Common ================================
//188ma as 100%
extern float getPosnBriSet();

//188ma as 100%
extern float getStarrySkyBriSet();

extern bool IsFloatEqual(float f1, float f2);

/**
 * @brief Public can0 Bus off
 *
 * @param N/A
 * @return bool
 *          true : bus off
 *          false : everything is ok
 */
extern bool IsPublicCan0BusOff();

/**
 * @brief LCU lost VIU
 *
 * @param N/A
 * @return bool
 *          true : lost
 *          false : everything is ok
 */
extern bool IsViuLost();

/**
 * @brief 0x378 communication timeout
 *
 * @param N/A
 * @return bool
 *          true : timeout
 *          false : everything is ok
 */
extern bool Is0x378CommunicationTimeout();

//==============================Sleep/Weak Up==============================
/**
 * @brief Query system status sleep or weakup
 *
 * @param N/A
 * @return bool
 *          true : start sleep
 *          false : start weak up
 */
extern bool IsSystemRequestSleep();

/**
 * @brief Set system status as sleep
 *
 * @param N/A
 * @return void
 */
extern void SystemCtrl_StartSleep();

/**
 * @brief Set system status as weakup
 *
 * @param N/A
 * @return void
 */
extern void SystemCtrl_StartWeakup();

//=========================== DayTime/Posn/StarrySky Lamp ================================
//---------------------------Input---------------------------
/**
 * @brief Daytime running lights on and off command
 *
 * @param N/A
 * @return  DaytimeLampOnCmd
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 */
extern OnOffFlag Get_CANSIG_DaytimeLampOnCmd(void);

/**
 * @brief Posn lamp on off command
 *
 * @param N/A
 * @return  LoBeamOnCmd
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 */
extern OnOffFlag Get_CANSIG_FLPosnLampOnCmd(void);

/**
 * @brief Posn lamp  brightness
 *
 * @param N/A
 * @return  FLPosnLampBriSet
 *          0x0: Initial
 *          0x1: Night
 *          0x2: Daytime1
 *          0x3: Daytime2
 *          0x7: Invalid
 */
extern FLPosnLampBriSetFlag Get_CANSIG_FLPosnLampBriSet(void);

/**
 * @brief Posn lamp flow effect control input signal
 *
 * @param time  : The time when the water lamp is completed
 * @param direction : Flow direction
 * @param performance : Water lamp extinguishing mode
 * @return  void
 */
extern void Get_UARTCAN_FLPosnLampFlowEffect(uint8_t* time, uint8_t* direction, uint8_t* performance);

/**
 * @brief Starry sky lamp lamp flow effect control input signal
 *
 * @param time  : The time when the water lamp is completed
 * @param direction : Flow direction
 * @param performance : Water lamp extinguishing mode
 * @return  void
 */
extern void Get_UARTCAN_StarrySkyFlowEffect(uint8_t* time, uint8_t* direction, uint8_t* performance);

/**
 * @brief Derating factor caused by voltage
 *
 * @param N/A
 * @return  float 
 *          percent : 0~100
 */
extern float LocalQuery_TurnLampBrightness_Voltage(void);

/**
 * @brief Derating factor caused by voltage
 *
 * @param N/A
 * @return  float 
 *          percent : 0~100
 */
extern float LocalQuery_TurnLampBrightness_Temperature(void);

/**
 * @brief Query Turn StarrySky Brightness
 *
 * @param N/A
 * @return  float 
 *          percent : 0~100
 */
extern float LocalQuery_StarrySkyLampBrightness_Voltage(void);

/**
 * @brief Query Turn StarrySky Brightness
 *
 * @param N/A
 * @return  float 
 *          percent : 0~100
 */
extern float LocalQuery_StarrySkyLampBrightness_Temperature(void);

//---------------------------Diag---------------------------
/**
 * @brief LUC query TurnLamp Panel Breakdown or not
 * @param N/A
 * @return  bool
 *          true : break down
 *          false : everything are fine
 */
extern bool IsTurnLampPanelBreakdown();

/**
 * @brief LUC query LCU and lamp panel communication statue
 * @param N/A
 * @return  bool
 *          true : break down
 *          false : everything are fine
 */
extern bool IsUartCanBreakDown();

/**
 * @brief Query Daytime And Posn NTC ShortCircuit or not
 *
 * @param N/A
 * @return  bool 
 *          true : ShortCircuit
 *          false : NOT 
 */
extern bool IsDaytimeAndPosnNTCShortCircuit();

/**
 * @brief Query Daytime And Posn NTC OpenCircuit or not
 *
 * @param N/A
 * @return  bool 
 *          true : OpenCircuit
 *          false : NOT 
 */
extern bool IsDaytimeAndPosnNTCOpenCircuit();

/**
 * @brief Query StarrySky NTC ShortCircuit or not
 *
 * @param N/A
 * @return  bool 
 *          true : ShortCircuit
 *          false : NOT 
 */
extern bool IsStarrySkyNTCShortCircuit();

/**
 * @brief Query StarrySky NTC OpenCircuit or not
 *
 * @param N/A
 * @return  bool 
 *          true : OpenCircuit
 *          false : NOT 
 */
extern bool IsStarrySkyNTCOpenCircuit();

//---------------------------Output---------------------------
/**
 * @brief Left front daytime running light on and off
 *
 * @param FLDaytimeLampOnSt
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 * @return  void
 */
extern void Set_CANSIG_FLDaytimeLampOnSt(OnOffFlag value);

/**
 * @brief Left front daytime running light malfunction
 *
 * @param FLDaytimeLampFlt
 *          0x0 : Initial
 *          0x1 : No Fault
 *          0x2 : Fault
 *          0x3 : Invalid
 * @return  void
 */
extern void Set_CANSIG_FLDaytimeLampFlt(DiagFlag value);   

/**
 * @brief Posn On Off status
 *
 * @param LeFrntPosnLampOnSt
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 * @return  void
 */
extern void Set_CANSIG_LeFrntPosnLampOnSt(OnOffFlag value);

/**
 * @brief Posn brightness
 *
 * @param LeFrntPosnLampBri
 *          0x0: Initial
 *          0x1: Night
 *          0x2: Daytime1
 *          0x3: Daytime2
 *          0x7: Invalid
 * @return  void
 */
extern void Set_CANSIG_LeFrntPosnLampBri(float value);

/**
 * @brief Posn diag fault
 *
 * @param LeFrntPosnLampFlt
 *          0x0 : Initial
 *          0x1 : No Fault
 *          0x2 : Fault
 *          0x3 : Invalid
 * @return  void
 */
extern void Set_CANSIG_LeFrntPosnLampFlt(DiagFlag value);

//---------------------------Light Ctrl---------------------------

bool Is_PO_SW_State(void);

/**
 * @brief Posn lamp control
 *
 * @param change_mask :  mask brightness change lamp as 1
 * @param onoff_mask  :  mask turn on lamp as 1, turn off as 0
 * @param pwms        :  brightness
 * @return  void
 */
extern void Set_LampCtrl_DaytimeAndPosnLampsStatus(uint32_t change_mask, uint32_t onoff_mask, float32 current);
/**
 * @brief LUC query Posn brightness
 *
 * @param N/A
 * @return  float
 *          100 : daytime lamp
 *          < 90 : posn lamp
 */
extern float LocalQuery_LeFrntDaytimePosnLampBri();

/**
 * @brief Query if Daytime/Posn Dev busy
 *
 * @param bool
 *          true : busy
 *          false : free
 * @return  void
 */
extern bool IsDayTimeAndPosnDevBusy();

/**
 * @brief Starry sky lamp control
 *
 * @param change_mask : mask brightness change lamp as 1
 * @param onoff_mask  :  mask turn on lamp as 1, turn off as 0
 * @param pwms        :  brightness
 * @return  void
 */
extern void Set_LampCtrl_StarrySkyLampsStatus(uint32_t change_mask, uint32_t onoff_mask, float32 current);

/**
 * @brief LUC query StarrySky lamp on/off status
 *
 * @param N/A
 * @return  FLCornerLampOnSt
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 */
extern OnOffFlag LocalQuery_StarrySkyLampsOnOffSt();

/**
 * @brief Query if StarrySky Lamps Dev busy
 *
 * @param bool
 *          true : busy
 *          false : free
 * @return  void
 */
extern bool IsStarrySkyLampsDevBusy();

/**
 * @brief Control StarrySkyAndPo2 HSOUT2 On/Off
 *
 * @param bool
 *          true : 1
 *          false : 0
 * @return  void
 */
extern void Set_LampCtrl_StarrySkyAndPo2Lamp_Enable(bool value);

//================================================================

//=========================== DLP Module ================================
//---------------------------Input---------------------------
/**
 * @brief DLP LED brightness gear setting
 *
 * @param N/A
 * @return  PubOdpBrtnsAdjstReq
 *          0 : OFF
 *          1~99 : level1~level99
 */
uint8_t Get_CANSIG_OdpLedBrtnsAdjstReq(void);

/**
 * @brief Projection Angle gear setting
 *
 * @param N/A
 * @return  PubProjectionAngleAdjstReq
 *          0x0=level0 (projection to ground)
 *          0x1=level1 (projection to Wall)
 *          0x2=level2 (illumination)
 *          0x3~0x7=Invalid
 */
ProjectionAngle  Get_CANSIG_PubProjectionAngleAdjstReq(void);
/**
 * @brief LM3409 Enable
 *
 * @param N/A
 * @return  IO_LM3409_EN
 *          true : enable
 *          false : disable
 */
extern bool Is_IO_LM3409_EN(void);

//---------------------------Diag---------------------------
// TODO

//---------------------------Output---------------------------
extern void Set_CANSIG_LCU_FL1_PubOdpBrtnsAdjstFb(uint16_t value);   

//---------------------------Light Ctrl---------------------------
/**
 * @brief Constant current power supply
 *
 * @param DLP_LED1
 *          true  : Iutput 1
 *          false : Output 0
 * @return  void
 */

extern void Set_DLP_LED1(bool value);
/**
 * @brief Constant current power supply
 *
 * @param DLP_LED2
 *          true  : Iutput 1
 *          false : Output 0
 * @return  void
 */
extern void Set_DLP_LED2(bool value);

/**
 * @brief DLP LED brightness gear setting
 *
 * @param DO_S32K_SL3409_PWM1
 *          0 : OFF
 *          1~99 : level1~level99
 * @return  void
 */
extern void Set_DO_S32K_SL3409_PWM(uint8_t value);    //DO_S32K_SL3409_PWM

/**
 * @brief LM3409 Enable
 *
 * @param LM3409_EN
 *          true  : Enable
 *          false : Disable
 * @return  void
 */
extern void Set_LM3409_EN(bool value);

/**
 * @brief Projection Angle gear setting
 *
 * @param ProjectionAngle
 *          -4.5 ~ 44.5
 * @return  void
 */
extern void Set_MotorCtrl_ProjectionAngle(float angle);
//================================================================

//=========================== Hibeam Lamp ================================

//---------------------------Input---------------------------
/**
 * @brief High beam lights off command
 *
 * @param N/A
 * @return  HiBeamOnCmd
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 */
extern OnOffFlag Get_CANSIG_HiBeamOnCmd(void);

/**
 * @brief Adaptive high beam function activation command
 *
 * @param N/A
 * @return  AdpvHiBeamFctOnCmd
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 */
extern OnOffFlag Get_CANSIG_AdpvHiBeamFctOnCmd(void);

/**
 * @brief HiBeam OnOff Cmd
 *
 * @param N/A
 * @return  ADS_HiBeamReq
 *          0x0 : No Request
 *          0x1 : Off
 *          0x2 : On
 */
extern ADS_HiBeamReqType Get_CANSIG_ADS_HiBeamReq(void);

/**
 * @brief HiBeam OnOff Cmd
 *
 * @param N/A
 * @return  ADS_HMAStatus
 *          0x0 : Off
 *          0x1 : Standby
 *          0x2 : Active
 *          0x3 : Failure
 */
extern ADS_HMAStatusType Get_CANSIG_ADS_HMAStatus(void);

/**
 * @brief Query HiBeam Brightness
 *
 * @param N/A
 * @return  float 
 *          pwm : 0~100
 */
extern float LocalQuery_HibeamBrightness_Voltage();

/**
 * @brief Query HiBeam Brightness
 *
 * @param N/A
 * @return  float 
 *          pwm : 0~100
 */
extern float LocalQuery_HibeamBrightness_Temperature();

/**
 * @brief Query HiBeam NTC ShortCircuit or not
 *
 * @param N/A
 * @return  bool 
 *          true : ShortCircuit
 *          false : NOT 
 */
extern bool IsHiBeamNTCShortCircuit();

/**
 * @brief Query HiBeam NTC OpenCircuit or not
 *
 * @param N/A
 * @return  bool 
 *          true : OpenCircuit
 *          false : NOT 
 */
extern bool IsHiBeamNTCOpenCircuit();

//---------------------------Diag---------------------------
/**
 * @brief LUC query Hibeam lamp Diag status
 *  1. The LCU detects that the Buck channel of the left far-optical module is faulty. Procedure
 *  2. The left high beam LED module drive is faulty
 *  3. The left high beam LED module drive is faulty
 * @param N/A
 * @return  LeLoBeamFlt
 *          0x0 : Diag_Initial
 *          0x1 : Diag_NoFault
 *          0x2 : Diag_Fault
 *          0x3 : Diag_Invalid
 */
extern DiagFlag LocalQuery_HibeamFault();

//---------------------------Output---------------------------
/**
 * @brief Left high beam light on and off
 *
 * @param LeHiBeamOnSt
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 * @return  void
 */
extern void Set_CANSIG_LeHiBeamOnSt(OnOffFlag value);

/**
 * @brief The left high beam is faulty
 *
 * @param LeHiBeamFlt
 *          0x0 : Initial
 *          0x1 : No Fault
 *          0x2 : Fault
 *          0x3 : Invalid
 * @return  void
 */
extern void Set_CANSIG_LeHiBeamFlt(DiagFlag value);

/**
 * @brief Adaptive high beam function On Off state
 *
 * @param  LCU_FL_AdpvHiBeamFctSt
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 * @return  void
 */
extern void Set_CANSIG_LCU_FL_AdpvHiBeamFctSt(OnOffFlag value);

//---------------------------Light Ctrl---------------------------
/**
 * @brief Set Hibeam pwm
 *
 * @param float
 *          0.0 ~ 100.0
 * @return  void
 */
extern void Set_Lamp_Ctrl_HiBeamPwm(float pwm);

/**
 * @brief High beam constant current output
 *
 * @param HB_LED
 *          true  : Iutput 1
 *          false : Output 0
 * @return  void
 */
extern void Set_HiBeam_OnOffState(bool value);

/**
 * @brief LUC query hibeam lamp on/off status
 *
 * @param N/A
 * @return  LeHiBeamOnSt
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 */
extern OnOffFlag LocalQuery_LeHiBeamOnSt();

/**
 * @brief Query if HiBeam Dev busy
 *
 * @param bool
 *          true : busy
 *          false : free
 * @return  void
 */
extern bool IsHiBeamDevBusy();
//================================================================

//=========================== Ribbon ================================
//---------------------------Input---------------------------
/**
 * @brief Vehicle user mode
 *
 * @param N/A
 * @return  UsageMode
 *         0x0: Abandoned
 *         0x1: Inactive
 *         0x2: Convenience
 *         0x3: Driving
 *         0x4: OTA Updating
 *         0x5: Remote
 *         0x6: RemoteDriving
 *         0x7~0xE: reserved
 *         0xF: Invalid
*/
extern UsageModeFlag Get_CANSIG_UsageMode(void);

/**
 * @brief Left ture lamp Ribbon  effect control command
 *
 * @param N/A
 * @return  FrntRibbonLampEffectCtrlCmd
 *          0x0: Initial
 *          0x1: No Request
 *          0x2: Off
 *          0x3: On
 *          0x4: Pause
 *          0x5: Again
 *          0xF: Invalid
*/
extern RibbonCtrlCmd Get_CANSIG_FrntRibbonLampEffectCtrlCmd(void);

/**
 * @brief Left ture lamp Ribbon effect selection
 *
 * @param N/A
 * @return  FrntRibbonLampEffectSel
 *          0x0: Initial
 *          0x1: Effect 1
 *          0x2: Effect 2
 *          0x3: Effect 3
 *          ...
 *          0xE: Effect 14
 *          0xF: Invalid
*/
extern RibbonEffectSel Get_CANSIG_FrntRibbonLampEffectSel(void);

/**
 * @brief Front through light whisper effect mode setting
 *
 * @param N/A
 * @return  FrntRibbonLampEffectModSet
 *          0x0: Initial
 *          0x1: Off
 *          0x2: Hold
 *          0x3: Repeat
*/
extern RibbonEffectMod Get_CANSIG_FrntRibbonLampEffectModSet(void);

/**
 * @brief Lobeam Ribbon effect control command
 *
 * @param N/A
 * @return  LoBeamEffectCtrlCmd
 *          0x0: Initial
 *          0x1: No Request
 *          0x2: Off
 *          0x3: On
 *          0x4: Pause
 *          0x5: Again
 *          0xF: Invalid
*/
extern RibbonCtrlCmd Get_CANSIG_LoBeamEffectCtrlCmd(void);

/**
 * @brief Lobeam Ribbon effect selection
 *
 * @param N/A
 * @return  FrntRibbonLampEffectSel
 *          0x0: Initial
 *          0x1: Effect 1
 *          0x2: Effect 2
 *          0x3: Effect 3
 *          ...
 *          0xE: Effect 14
 *          0xF: Invalid
*/
extern RibbonEffectSel Get_CANSIG_LoBeamEffectSel(void);

/**
 * Delete
 * @brief Lobeam Ribbon effect mode setting
 *
 * @param N/A
 * @return  LoBeamEffectModSet
 *          0x0: Initial
 *          0x1: Off
 *          0x2: Hold
 *          0x3: Repeat
*/
extern RibbonEffectMod Get_CANSIG_LoBeamEffectModSet(void);

//---------------------------Output---------------------------
/**
 * @brief Front through light Off on state
 *
 * @param FrntRibbonLampEffectShowSt
 *          0x0: OFF
 *          0x1: Running
 *          0x2: Pause
 *          0x3: Hold
 *          0x4~0x6: Reserved
 *          0x7: Invalid
 * @return  void
 */
extern void Set_CANSIG_FrntRibbonLampEffectShowSt(RibbonEffectShowSt value);

/**
 * @brief Front through light effect statue
 *
 * @param FrntRibbonLampEffectShowSt
 *          0x0: Initial
 *          0x1: Effect 1
 *          0x2: Effect 2
 *          0x3: Effect 3
 *          0xE: Effect 14
 *          0xF: Invalid
 * @return  void
 */
extern void Set_CANSIG_FrntRibbonLampEffectSt(RibbonEffectSel value);

/**
 * @brief Lobeam Off on state
 *
 * @param FrntRibbonLampEffectShowSt
 *          0x0: OFF
 *          0x1: Running
 *          0x2: Pause
 *          0x3: Hold
 *          0x4~0x6: Reserved
 *          0x7: Invalid
 * @return  void
 */
extern void Set_CANSIG_LoBeamEffectShowSt(RibbonEffectShowSt value);

/**
 * @brief Lobeam effect statue
 *
 * @param FrntRibbonLampEffectShowSt
 *          0x0: OFF
 *          0x1: Running
 *          0x2: Pause
 *          0x3: Hold
 *          0x4~0x6: Reserved
 *          0x7: Invalid
 * @return  void
 */
extern void Set_CANSIG_LoBeamEffectSt(RibbonEffectSel value);

//================================================================

//=========================== LeTurn(Left turn) Lamp ================================
//---------------------------Input---------------------------
/**
 * @brief Left trun lamp enbale signal
 *
 * @param N/A
 * @return  TL_EN
 *          true : 1
 *          false : 0
 */
extern bool Is_TL_EN(void);

/**
 * @brief Left trun lamp flow enbale signal
 *
 * @param N/A
 * @return  TL_Flow
 *          true : 1
 *          false : 0
 */
extern bool Is_TL_Flow(void);

/**
 * @brief Left trun lamp Occupy signal
 *
 * @param N/A
 * @return  TurnLampOccupySts
 *          0x0: OFF
 *          0x1: LeTurn
 *          0x2: RiTurn
 *          0x3: All
 */
extern TurnLampOccupyStsFlag Get_CANSIG_TurnLampOccupySts(void);

/**
 * @brief Left trun lamp flow effect control input signal
 *
 * @param time  : The time when the water lamp is completed
 * @param direction : Flow direction
 * @param performance : Water lamp extinguishing mode
 * @return  void
 */
extern void Get_UARTCAN_LeFrntTurnLampFlowEffect(uint8_t* time, uint8_t* direction, uint8_t* performance);

//---------------------------Diag---------------------------
/**
 * @brief LUC query Left turn lamp Diag status
 *  1. Communication failure between the LCU and UART CAN of the turn signal (either linear chip)
 *  2. TL_SW Output Issue
 *  3. LeFrntTurnLamp led issue
 *  4. PO_SW Output Issue
 *  5. The LCU detects an open or short circuit of DRL_LED+
 * @param N/A
 * @return  LeLoBeamFlt
 *          0x0 : Diag_Initial
 *          0x1 : Diag_NoFault
 *          0x2 : Diag_Fault
 *          0x3 : Diag_Invalid
 */
extern DiagFlag LocalQuery_LeTurnLampFault();

//---------------------------Output---------------------------
/**
 * @brief Left front turn signal on and off
 *
 * @param LeFrntTurnLampOnSt
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 * @return  void
 */
extern void Set_CANSIG_LeFrntTurnLampOnSt(OnOffFlag value);

/**
 * @brief The left front turn signal is faulty
 *
 * @param LeHiBeamFlt
 *          0x0 : Initial
 *          0x1 : No Fault
 *          0x2 : Fault
 *          0x3 : Invalid
 * @return  void
 */
extern void Set_CANSIG_LeFrntTurnLampFlt(DiagFlag value);

//---------------------------Light Ctrl---------------------------
/**
 * @brief Left turn Lamp switch
 *
 * @param TL_SW
 *          true  : Iutput 1
 *          false : Output 0
 * @return  void
 */
extern void Set_LeFrntTurnLamp_OnOffState(bool value);
extern bool Is_TL_SW_State(void);

/**
 * @brief Left turn lamp control
 *
 * @param change_mask :  mask brightness change lamp as 1
 * @param onoff_mask  :  mask turn on lamp as 1, turn off as 0
 * @param current     :  current
 * @return  void
 */
extern void Set_LampCtrl_TurnLampsStatus(uint32_t change_mask, uint32_t onoff_mask, float current);

/**
 * @brief LUC query LeTurn lamp on/off status
 *
 * @param N/A
 * @return  LeFrntTurnLampOnSt
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 */
extern OnOffFlag LocalQuery_LeFrntTurnLampOnSt();

/**
 * @brief Query if LeFrntTurnLamp Dev busy
 *
 * @param bool
 *          true : busy
 *          false : free
 * @return  void
 */
extern bool IsLeFrntTurnLampDevBusy();

//================================================================

//=========================== LoBeam ================================
//---------------------------Input---------------------------
/**
 * @brief Lobeam on off command
 *
 * @param N/A
 * @return  LoBeamOnCmd
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 */
extern OnOffFlag Get_CANSIG_LoBeamOnCmd(void);


/**
 * @brief Derating factor caused by voltage
 *
 * @param N/A
 * @return  float 
 *          percent : 0~100
 */
extern float LocalQuery_LobeamBrightness_Voltage();

/**
 * @brief Derating coefficient caused by temperature
 *
 * @param N/A
 * @return  float 
 *          percent : 0~100
 */
extern float LocalQuery_LobeamBrightness_Temperature();

/**
 * @brief Query LoBeam NTC ShortCircuit or not
 *
 * @param N/A
 * @return  bool 
 *          true : ShortCircuit
 *          false : NOT 
 */
extern bool IsLoBeamNTCShortCircuit();

/**
 * @brief Query LoBeam NTC OpenCircuit or not
 *
 * @param N/A
 * @return  bool 
 *          true : OpenCircuit
 *          false : NOT 
 */
extern bool IsLoBeamNTCOpenCircuit();

//---------------------------Diag---------------------------
/**
 * @brief LUC query Lobeam lamp Diag status
 *  1. The LCU detects that the Buck channel of the near-left optical module is faulty. Procedure
 *  2. The left and near light LED module driver is faulty
 *  3. The output voltage of the Buck circuit of the near left light is faulty
 * @param N/A
 * @return  LeLoBeamFlt
 *          0x0 : Diag_Initial
 *          0x1 : Diag_NoFault
 *          0x2 : Diag_Fault
 *          0x3 : Diag_Invalid
 */
extern DiagFlag LocalQuery_LeLoBeamFlt();

//---------------------------Output---------------------------
/**
 * @brief Lobeam On Off status
 *=
 * @param LeLoBeamOnSt
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 * @return  void
 */
extern void Set_CANSIG_LeLoBeamOnSt(OnOffFlag value);

/**
 * @brief Lobeam  diag fault
 *
 * @param LeHiBeamFlt
 *          0x0 : Initial
 *          0x1 : No Fault
 *          0x2 : Fault
 *          0x3 : Invalid
 * @return  void
 */
extern void Set_CANSIG_LeLoBeamFlt(DiagFlag value);

//---------------------------Light Ctrl---------------------------
/**
 * @brief Lobeam switch
 *
 * @param TL_SW
 *          true  : Iutput 1
 *          false : Output 0
 * @return  void
 */
extern void Set_LoBeam_OnOffState(bool value);

/**
 * @brief Lobeam brightness
 *
 * @param pwm : 1 ~ 100
 * @return  void
 */
extern void Set_Lamp_Ctrl_LobeamPwm(float pwm);

/**
 * @brief Switch between Lobeam and Corner Lamp
 *
 * @param TL_SW
 *          true  : Iutput 1
 *          false : Output 0
 * @return  void
 */
extern void Set_LampCtrl_SwitchBetweenCornerLampAndLoBeam(bool value);

/**
 * @brief LUC query Lobeam lamp on/off status
 *
 * @param N/A
 * @return  LeLoBeamOnSt
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 */
extern OnOffFlag LocalQuery_LeLoBeamOnSt();

//---------------------------Light Ctrl---------------------------

/**
 * @brief Decoration switch 
 *
 * @param TL_SW
 *          true  : Iutput 1
 *          false : Output 0
 * @return  void
 */
extern void Set_PO2_OnOffState(bool value);

/**
 * @brief LUC query po2 lamp on/off status
 *
 * @param N/A
 * @return  po2OnSt
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 */
extern OnOffFlag LocalQuery_Po2OnOffSt();

/**
 * @brief Query if LoBeam Dev busy
 *
 * @param bool
 *          true : busy
 *          false : free
 * @return  void
 */
extern bool IsLoBeamDevBusy();
//================================================================

//=========================== Corner Lamp ================================
//---------------------------Input---------------------------
/**
 * @brief Adaptive lamp enable
 *
 * @param N/A
 * @return  AFSEna
 *          0x0: Initial
 *          0x1: Disable
 *          0x2: Enable
 *          0x3: Invalid
 */
extern AFSEnaFlag Get_CANSIG_AFSEna(void);

/**
 * @brief Vehicle Speed
 *
 * @param N/A
 * @return  float
 */
extern float Get_CANSIG_VehicleSpeed(void);

/**
 * @brief Steering Wheel Angle
 *
 * @param N/A
 * @return  float
 */
extern float Get_CANSIG_SteeringAngle(void);

/**
 * @brief Derating factor caused by voltage
 *
 * @param N/A
 * @return  float 
 *          percent : 0~100
 */
extern float LocalQuery_CornerLampBrightness_Voltage();

/**
 * @brief Derating coefficient caused by temperature
 *
 * @param N/A
 * @return  float 
 *          percent : 0~100
 */
extern float LocalQuery_CornerLampBrightness_Temperature();

/**
 * @brief Query CornerLamp NTC ShortCircuit or not
 *
 * @param N/A
 * @return  bool 
 *          true : ShortCircuit
 *          false : NOT 
 */
extern bool IsCornerLampNTCShortCircuit();

/**
 * @brief Query CornerLamp NTC OpenCircuit or not
 *
 * @param N/A
 * @return  bool 
 *          true : OpenCircuit
 *          false : NOT 
 */
extern bool IsCornerLampNTCOpenCircuit();

//---------------------------Diag---------------------------
/**
 * @brief Corner  Lamp switch fault
 *
 * @param N/A
 * @return  true : Issue
 *          false: No diagnose
 */
extern bool Is_CL_SW_SwitchIssue(void);

/**
 * @brief LUC query Corner lamp Diag status
 *  1. Corner  Lamp switch fault
 *  2. The lobeam power supply is abnormal
 *  3. The short-light buck channel is faulty
 *  4. The output voltage of the near light is faulty
 * @param N/A
 * @return  LeLoBeamFlt
 *          0x0 : Diag_Initial
 *          0x1 : Diag_NoFault
 *          0x2 : Diag_Fault
 *          0x3 : Diag_Invalid
 */
extern DiagFlag LocalQuery_CornerLampFault();

//---------------------------Output---------------------------
/**
 * @brief Corner lamp On Off status
 *
 * @param LeFrntPosnLampOnSt
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 * @return  void
 */
extern void Set_CANSIG_LCU_FL_FLCornerLampOnSt(OnOffFlag value);

/**
 * @brief Corner lamp diag fault
 *
 * @param FL_FLCornerLampFlt
 *          0x0 : Initial
 *          0x1 : No Fault
 *          0x2 : Fault
 *          0x3 : Invalid
 * @return  void
 */
extern void Set_CANSIG_LCU_FL_FLCornerLampFlt(DiagFlag value);

//---------------------------Light Ctrl---------------------------
/**
 * @brief Corner lamp enable
 *
 * @param CL_LED
 *          true  : Iutput 1
 *          false : Output 0
 * @return  void
 */
extern void Set_Corner_OnOffState(bool value);

/**
 * @brief Corner lamp brightness
 *
 * @param float
 *          pwm : 0 ~ 100
 * @return  void
 */
extern void Set_Corner_brightness(float value);


extern void Set_CL_SW(uint8 value);
extern uint8 Is_CL_SW_State(void);



/**
 * @brief LUC query FLCorner lamp on/off status
 *
 * @param N/A
 * @return  FLCornerLampOnSt
 *          0x0 : Initial
 *          0x1 : Off
 *          0x2 : On
 *          0x3 : Invalid
 */
extern OnOffFlag LocalQuery_FL_FLCornerLampOnSt();


//================================================================

//-----------------------------Fan-------------------------------
extern void Set_FanCtrl_OnOffState(bool value);

#endif
